<template>
  <div class="maintainProject">
    <DFPageList ref="dfPageListRef" :page-options="pageOptions" />
  </div>
</template>

<script lang="ts" setup name="MaintainProject">
  import { ref } from 'vue';
  import lang from './lang';
  import {
    addMaintainProject,
    delMaintainProject,
    pageMaintainProject,
    updateMaintainProject,
    exportMaintainProject,
  } from '@/api/base/maintainProject';
  import { useMixins } from '@/hooks/useMixins';

  const { loadLangFn } = useMixins();

  const dfPageListRef: any = ref(null);

  loadLangFn(lang);

  const pageOptions = {
    searchForm: {
      formSchemas: [
        {
          label: 'maintainProjectName',
        },
        {
          label: 'maintainProjectCode',
        },
      ],
    },
    table: {
      hasSelection: true,
      columns: [
        {
          width: 120,
          label: 'maintainProjectName',
        },
        {
          width: 120,
          label: 'maintainProjectCode',
        },
        {
          width: 120,
          label: 'remark',
          common: true,
        },
      ],
      action: {
        columns: [
          {
            label: 'edit',
          },
          {
            label: 'delete',
          },
        ],
      },
      operaColumn: [
        {
          label: 'add',
        },
        {
          label: 'export',
        },
      ],
      requestFn: pageMaintainProject,
      delRequestFn: delMaintainProject,
      exportRequestFn: exportMaintainProject,
    },
    modalFormDialog: {
      formSchemas: [
        {
          label: 'maintainProjectName',
          required: true,
        },
        {
          label: 'maintainProjectCode',
          required: true,
          editDialogDisabled: true,
        },
        {
          label: 'remark',
          common: true,
          type: 'textarea',
        },
      ],
      addDataFn: addMaintainProject,
      updateDataFn: updateMaintainProject,
    },
  };
</script>
